<?php

namespace Shipment;

use C\L\WebUserController;
use C\M\Shipment;

class ShipmentController extends WebUserController
{
    /**
     * 物流接口
     **/
    public function showAction()
    {
        $id = $this->request->getQuery('id', 'int', 0);

        $shipment = Shipment::findFirst($id);

        if (! $shipment) {
            return $this->error('未找到该物流');
        }

        $shipment->traces = json_decode($shipment->traces);
        $shipment->other_info = json_decode($shipment->other_info);

        return $this->success($shipment);
    }
}
